package _23define;

import java.io.*;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        encodeFile(new File("src/note/a.txt"), new File("src/note/b.txt"));
    }
    public static void encodeFile(File encodingFile, File encodedFile) throws IOException {
        BufferedReader br=new BufferedReader(new FileReader(encodingFile));
        BufferedWriter ba=new BufferedWriter(new FileWriter(encodedFile));
        String line;
        while ((line=br.readLine())!=null){
            String newLine ="";
            for (int i = 0; i < line.length(); i++) {
                if ((line.charAt(i)>='0'&&line.charAt(i)<'9')||(line.charAt(i)>='a'&&line.charAt(i)<'z')||(line.charAt(i)>='A'&&line.charAt(i)<'Z')){
                    int a=line.charAt(i)-0;
                    String b= String.valueOf((char)(a+1));
                    newLine += b;
                }else if ((line.charAt(i)=='9')){
                    int a=line.charAt(i)-0;
                    String b=String.valueOf((char) (a-9));
                    newLine+=b;
                }else if ((line.charAt(i)=='z')||(line.charAt(i)=='Z')){
                    int a=line.charAt(i)-0;
                    String b=String.valueOf((char) (a-23));
                    newLine+=b;
                }else {
                    System.out.println(newLine);
                    newLine+=line.charAt(i);
                    System.out.println(newLine);
                }
            }
            ba.write(newLine);
            ba.write("\t\r");
        }
        br.close();
        ba.flush();
        ba.close();
    }
}
